#ifndef CONTROLLER_H
#define CONTROLLER_H

#include "gameboard.h"

#include <QObject>


class Controller : public QObject
{
    Q_OBJECT

public:
    Controller();
    virtual ~Controller();

signals:
    void setSlider(Territory* terToSet);

public slots:
    void playGame();
    void setCurClickedTer(Territory* clicked);
    void clickActionArmyPlace(Territory* clicked);
    void clickActionCards(Cards* clicked);
    void clickActionReinf(Territory* clicked);
    void clickActionNext();
    void clickActionNext2();
    void clickActionRoll();
    void clickActionStopRoll();
    void clickActionAttack(Territory* clicked);
    void clickActionTactical(Territory* clicked);
    void clickActionMoveArmies();
    void clickActionMoveArmies2();
    void clickActionDone();

private:
    GameBoard*      m_gameboard;
    SetupWindow*    m_setup;
    Territory*      m_clickedTerr;
    Territory*      m_clickedTerr2;
    Cards*          m_clickedCard1;
    Cards*          m_clickedCard2;
    Cards*          m_clickedCard3;

    int m_curPlayerIndex;
    int m_numAvailTerr;
    int m_numArmy;
    int m_turnIns;
    int m_turnInAmount;
    int m_reinforce;
    int m_prevNumTerr;
    bool m_next;
    bool m_roll;
    int m_movedArmies;
    bool m_done;

    int getNextPlayerIndex();
    void territorySelection();
    void setPlayerTerritory();
    void armyPlacement();
    void addArmy();
    void reinforce();
    void placeReinf();
    void attack();
    void attackTerr();
    void rollTime();
    void calcReinf();
    void cardWindow();
    void turnInCards();
    void tacticalMove();
    void winCard(Player* attacker);
    void newTurn();
    void chooseArmies();
};

#endif // CONTROLLER_H
